package conexion;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author JoseHernanQC
 */
public class Conexion {
    
    public static Connection getConexion(){
        try {
            Class.forName("com.mysql.jdbc.Driver");
            //Properties
            String ip = "localhost";
            String puerto = "3306";
            String bd = "db_xsis";
            String usuario = "root";
            String password = "mysql";
            //String password = "";
            //Full url
            String url = "jdbc:mysql://"+ip+":"+puerto+"/"+bd;
            return DriverManager.getConnection(url, usuario, password);
        } catch (SQLException ex) {
            ex.printStackTrace();
            System.out.println(ex.getErrorCode());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return null;
    }
}
